package com.easy.common.util.file;
import java.io.File;
import java.io.FileFilter;

public class FileDifFilter 
	implements FileFilter
{
	private String newDir;
	private String oldDir;

	public FileDifFilter(String newDir, String oldDir)
	{
		this.newDir = null;
		this.oldDir = null;
		this.newDir = newDir;
		this.oldDir = oldDir;
	}

	public boolean accept(File file)
	{
		try{
			File oldFile = new File((new StringBuilder(String.valueOf(oldDir))).append(file.getAbsolutePath().substring(newDir.length())).toString());
			if (!oldFile.exists())
				return true;
			return !FileUtility.isFileEqual(file, oldFile);
		}
		catch(Exception ex){}
		return false;
	}

}
